#include <bits/stdc++.h>
using namespace std;
int x;
int f(int x){
    int ans = 0;
    for (int i = 1; i <= x; i ++){
        for (int j = 1; j <= x; j ++){
            cout << i * j;
            ans += i * i / j;
        }
    }
    return ans;
}
int main(){
    freopen("arena.in", "r", stdin);
    freopen("arena.out", "w", stdout);
    cin >> x;
    cout << f(x * x % 114);
    return 0;
}
